Difference between abstract class and interface

In short, in case of full abstraction of methods you want to define use interface, in case of partial abstraction, if some methods you want to define are common among concrete classes but some are not then use abstract class

Abstract class can have definitions of constants, abstract methods or method stubs (methods without body/implementation) and normal
methods with implementation. A child class can extend only one abstract class and it can override (polymorphism) visibility of methods from abstract
classes as public, protected or private.

Interface can have only constants and abstract methods and all abstract methods of an interface must be public. A child
class can implement multiple interfaces at once and all methods must be/remain public.

Leave a Reply